read in the data
alice_counties <- fread(here::here("/data/alice/alice_counties.csv")) %>%
mutate(County = paste0(County, " County, " ,State_Abbr),
Wasco = fct_other(County, keep = c("Wasco County, OR", "Hood River County, OR",
"Klickitat County, WA", "Jefferson County, OR",
"Sherman County, OR", "Skamania County, WA"),
other_level = "Other Counties"),
Wasco = factor(Wasco, levels = c("Other Counties", "Hood River County, OR",
"Klickitat County, WA", "Jefferson County, OR",
"Sherman County, OR", "Skamania County, WA",
"Wasco County, OR"))) %>%
select(-c("GEO.id" ,"GEO.display_label","State","State_Abbr","Poverty_Household","ALICE_Household"))
graypal = "#ADB5BD"
Visualize with the grouped line chart
ggplotly(ggplot(alice_counties,
aes(x=Year, y=Percent_ALICE_Households, group = County, color = Wasco,
text = paste0("County: ", County,
"<br>Year: ", Year,
"<br>Below ALICE Threshold: ", Percent_ALICE_Households, "%"))) +
geom_line(size = 1) +
geom_point(size = 1.5) +
scale_color_manual(name = "County", values = c(graypal, viridis(6, option = "D"))) +
theme_minimal() + ggtitle("Households Below ALICE Threshold 2010-2018") + ylab("Below ALICE Threshold (%)") + xlab("Year"), tooltip = "text") %>% config(displayModeBar = "static", displaylogo = FALSE,
modeBarButtonsToRemove=list("zoom2d","select2d","lasso2d",
"hoverClosestCartesian", "hoverCompareCartesian","resetScale2d"))
## Warning: `group_by_()` is deprecated as of dplyr 0.7.0.
## Please use `group_by()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.